import axios from 'axios'

const instance=axios.create({
    baseURL:'http://localhost:9000'
})
const instance2=axios.create({
    baseURL:'http://localhost:8080'
})
const $http2={
    get({
        url,
        params
    }){
        return new Promise((resolve,reject)=>{
            instance2.get(url)
            .then((result)=>{
                resolve(result)
            })
            .catch((error)=>{
                reject(error)
            })

        })
    }
}
const $http={
    get({
        url
    }){
        return new Promise((resolve,reject)=>{
            instance.get(url)
            .then((result)=>{
                resolve(result)
            })
            .catch((error)=>{
                reject(error)
            })

        })
    }
}
const httpPlugin={}
httpPlugin.install=(Vue,option)=>{
    Vue.prototype.$http=$http
    Vue.prototype.$http2=$http2
    
}
export default httpPlugin